import userStore from '@/store/user';
import { request } from '@/service/request/request';

export const getUserFeedbacks = async (page, size) => {
    try {
        const userId = userStore.getUserInfo().id;
        const data = {
            userId: userId,
            page: page,
            size: size
        };
        return await request('/problem/get-user-feedback', data);
    } catch (err) {
        throw err;
    }
};

export const submitFeedback = async (title, description) => {
    try {
        const userId = userStore.getUserInfo().id;
        const data = {
            customerId: userId,
            title: title,
            description: description
        };
        await request('/problem/submit-question-feedback', data);
    } catch (err) {
        throw err;
    }
};

export const deleteFeedback = async (id) => {
    try {
        await request('/problem/delete-question-feedback', { id: id });
    } catch (err) {
        throw err;
    }
};
